package com.mgetool.ui.util;
/*package ui.util;

import ui.AbstractDrawable;


*//**
 * 图片数字类 用于用美术图片来显示数字
 * 默认美术图片数字为0~9，一共10个数字，横向排列在一张美术图片上
 * 如果传入负数 图片显示则为带 ”+“ 号的数字 即正数
 * @author wangbin
 *
 *//*
public class ImageNum extends AbstractDrawable{
	private String imageNumUrl;
	private IBitmapList numImage;
	//需要显示的数字
	private int showNum;
	//数字总数
	private static final int TOTAL_NUM = 10;
	//两个数字图片的间距
	private int cell = 0;
	//将多为数分割成个位数的数组
	private int[] splitNum;
	//加号
	private IBitmap addtion;
	*//**
	 * 构造方法
	 * @param imageNumUrl
	 * 			美术图片资源路径,默认该图片为十个数字在一张图片上
	 *//*
	private ScallingParam curScalling;
	public ImageNum(String imageNumUrl){
		setImageNumUrl(imageNumUrl);
	}
	
	@Override
	public void init() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onDraw(Canvas canvas, Paint paint) {
		// TODO Auto-generated method stub
		draw(canvas, getX(), getY(), paint, 0, null, -1);
	}

	public void draw(Canvas canvas, int x, int y, Paint paint, int rotate, ScallingParam scaling, int alpha){
		if(numImage != null && isShow()){
			if(splitNum != null){
				curScalling = scaling;
				setPosition(x, y);
				int xoff = 0;
				if(addtion != null){
					addtion.draw(canvas, x, y, paint);
					xoff = addtion.getWidth();
				}
				for(int i = 0; i < splitNum.length; i++){
//					numImage.draw(canvas, getX() + i * (numImage.getWidth() + cell), getY(), paint, splitNum[i]);
					float curW = numImage.getWidth();
					if(scaling != null){
						curW *= scaling.getScallingX();
					}
					numImage.draw(canvas, getX() + xoff + i * ((int)curW + cell), getY(), paint, rotate, scaling, alpha, splitNum[i]);
				}
			}
		}
	}
	
	@Override
	public boolean onKey(int keyCode, KeyEvent keyEvent) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean onTouch(MotionEvent event, int x, int y) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void onUpdate() {
		// TODO Auto-generated method stub
		
	}

	public IBitmapList getNumImage() {
		return numImage;
	}

	public void setNumImage(IBitmapList numImage) {
		this.numImage = numImage;
	}

	public String getImageNumUrl() {
		return imageNumUrl;
	}

	public void setImageNumUrl(String imageNumUrl) {
		this.imageNumUrl = imageNumUrl;
		IBitmapList bitmap = ResourceManager.getInstance().getIBitmapList(imageNumUrl, hashCode(), TOTAL_NUM);
		setNumImage(bitmap);
	}

	
	@Override
	public DrawerInterface getDrawer() {
		// TODO Auto-generated method stub
		if(numImage != null){
			return numImage.getDrawer();
		}
		return null;
	}

	public int getShowNum() {
		return showNum;
	}

	*//**
	 * 设置需要显示的数字
	 * @param showNum
	 *//*
	public void setShowNum(int showNum) {
		if(showNum < 0){
			if(addtion == null){
				addtion = ResourceManager.getInstance().getBitmap("/jiahao.png", hashCode());
			}
			showNum = Math.abs(showNum);
		}
		this.showNum = showNum;
		int num = showNum;
		int length = String.valueOf(showNum).length();
		splitNum = new int[length];
		for(int i = 0; i < length; i++){
			splitNum[i] = num % 10;
			num /= 10;
		}
		splitNum = Util.reverseArray(splitNum);
	}

	public int getCell() {
		return cell;
	}

	@Override
	public int getHeight() {
		// TODO Auto-generated method stub
		float h = 0;
		if(numImage != null){
			h = numImage.getHeight();
			if(curScalling != null){
				h *= curScalling.getScallingY();
			}
		}
		return (int)h;
	}

	@Override
	public int getWidth() {
		// TODO Auto-generated method stub
		if(splitNum != null && numImage != null){
			float w = 0;
			for(int i = 0; i < splitNum.length; i++){
				if(i != 0){
					w += getCell();
				}
				float curW = numImage.getWidth();
				if(curScalling != null){
					curW *= curScalling.getScallingX();
				}
				w += curW;
			}
			return (int)w;
		}
		return super.getWidth();
	}

	*//**
	 * 设置两个图片数字的间距
	 * @param cell
	 *//*
	public void setCell(int cell) {
		this.cell = cell;
	}
	
}
*/